<template>
    <swiper
      class="detailsSwiper"
      :options="swiperOption"
      ref="mySwiper"
      v-if="swiperData.length>0"
    >
      <swiper-slide v-for="(item, index) in swiperData" :key="index">
          <img :src="item" alt=""  />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
      <!-- <div class="swiper-button-prev" slot="button-prev"></div>
      <div class="swiper-button-next" slot="button-next"></div> -->
    </swiper>
</template>

<script>
// 引入插件
import { swiper, swiperSlide } from "vue-awesome-swiper";
import "swiper/dist/css/swiper.css";

export default {
  props: {
    swiperData: {
      type: Array,
      default: [],
    },
  },
  components: {
    swiper,
    swiperSlide,
  },
  data() {
    return {
      swiperOption: {
        loop: true,
        // autoplay: {
        //   delay: 2000,
        //   stopOnLastSlide: false,
        //   disableOnInteraction: false,
        // },
        observer:true,
        // 显示分页
        pagination: {
          el: ".swiper-pagination",
          clickable: true, //允许分页点击跳转
        },
        // 设置点击箭头
        // navigation: {
        //   nextEl: ".swiper-button-next",
        //   prevEl: ".swiper-button-prev",
        // },
      },
    };
  },
  methods: {

  },
  computed: {
    // swiper() {
    //   return this.$refs.mySwiper.swiper;
    // },
  },
  updated() {
   
  },
};
</script>
<style scoped >
.detailsSwiper{
  width: 100%;
  height: 250px;
  overflow: hidden;
}
.detailsSwiper img{
  width: 100%;
}

</style>
